import React, { useId } from "react";

// `useId`是一个钩子，用于生成唯一的ID
// 效果类似于es6里面的symbol
const App = () => {
  const useNameId = useId();
  const passwordId = useId();

  return (
    <>
      <h2>useId</h2>

      <div>
        <label htmlFor={useNameId}>用户名</label>
        <input type="text" id={useNameId} />
      </div>
      <div>
        <label htmlFor={passwordId}>密码</label>
        <input type="password" id={passwordId} />
      </div>
    </>
  );
};

export default App;
